/**
 *Copyright (c) 2024 watereyes
 * safetymanagement is licensed under Mulan PubL v2.
 * You can use this software according to the terms and conditions of the Mulan
 * PubL v2.
 * You may obtain a copy of Mulan PubL v2 at:
 *          http://license.coscl.org.cn/MulanPubL-2.0
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PubL v2 for more details.
 */
package com.koron.accident.util;

public enum  BusinessCode {
    SUCCESS(0,"success"),
    FAILURE(-1,"fail"),
    EXCEPTION(-2,"执行过程中发生异常"),
    NOT_LONGIN(10000,"获取用户失败,请重新登录"),
    EVENT_EMPTY_NAME(1020001,"事件名称不能为空"),
    EVENT_EMPTY_DEPARTMENTCODE(1020004,"事发单位不能为空"),
    EVENT_EMPTY_ACCIDENTTYPE(1020003,"事故类型不能为空"),
    EVENT_NOT_CHANGE_DATA(1020004,"未选中数据"),
    EVENT_NOT_EXIST(1020005,"事件不存在，无法操作"),
    PECCANCYRECORD_EMPTY_CORPCODE(1020006,"水司不能为空"),
    PECCANCYRECORD_EMPTY_PECCANCYSTAFF(1020007,"违章人员不能为空"),
    PECCANCYRECORD_EMPTY_PECCANCYSTAFFDEPT(1020008,"违章人员所在部门不能为空"),
    PECCANCYRECORD_EMPTY_PECCANCYBEHAVIOUR(1020009,"违章行为不能为空"),
    PECCANCYRECORD_EMPTY_PECCANCYDEGREE(1020010,"违章程度不能为空"),
    PECCANCYRECORD_EMPTY_PECCANCYTYPE(1020011,"违章类型不能为空"),
    PECCANCYRECORD_EMPTY_BUSINESSID(1020012,"关联事件id或者事故的id不能为空"),
    PECCANCYRECORD_NOT_CHANGE_DATA(1020013,"未选中数据"),
    PECCANCYRECORD_NOT_EXIST(1020014,"违章记录不存在"),
    PECCANCYRECORD_NOT_EXIST_BUSINESSID(1020015,"关联事件id或者事故的id不存在"),
    ACCIDENTBULLETIN_EMPTY_NAME(1020016,"事故快报名称不能为空"),
    ACCIDENTBULLETIN_EMPTY_ACCIDENTTYPE(1020017,"事件类型不能为空"),
    ACCIDENTBULLETIN_EMPTY_DEPARTMENTCODE(1020018,"事发单位不能为空"),
    ACCIDENTBULLETIN_NOT_CHANGE_DATA(1020019,"未选中数据"),
    ACCIDENTBULLETIN_NOT_EXIST(1020020,"事故快报不存在"),
    ACCIDENTREPORT_EMPTY_NAME(1020021,"事故报告名称不能为空"),
    ACCIDENTREPORT_EMPTY_ACCIDENTTYPE(1020022,"事件类型不能为空"),
    ACCIDENTREPORT_EMPTY_DEPARTMENTCODE(1020023,"事发单位不能为空"),
    ACCIDENTREPORT_NOT_CHANGE_DATA(1020024,"未选中数据"),
    ACCIDENTREPORT_NOT_EXIST(1020025,"事故报告不存在"),
    INJURIESREGISTER_EMPTY_STAFF(1020026,"人员不能为空"),
    INJURIESREGISTER_EMPTY_DEPARTMENTCODE(1020027,"单位部门不能为空"),
    INJURIESREGISTER_EMPTY_ACCIDENT(1020028,"所属事故不能为空"),
    INJURIESREGISTER_NOT_CHANGE_DATA(1020029,"未选中数据"),
    INJURIESREGISTER_NOT_EXIST(1020030,"工伤登记不存在"),
    WORKTIME_EMPTY_CORPCODE(1020031,"水司不能为空"),
    WORKTIME_EMPTY_DEPARTMENTCODE(1020032,"单位部门不能为空"),
    WORKTIME_EMPTY_YEARS(1020033,"工时年月不能为空"),
    WORKTIME_EMPTY_DAYS(1020034,"天数不能为空或者天数为负数"),
    WORKTIME_EMPTY_DAYWORKTIMES(1020035,"人工工时不能为空或者人工工时为负数"),
    WORKTIME_EMPTY_TOTALWORKTIES(1020036,"工时小计不能为空或者工时小计为负数"),
    WORKTIME_EMPTY_STAFFNUMBER(1020037,"单位人数不能为空或者单位人数为负数"),
    WORKTIME_NOT_CHANGE_DATA(1020038,"未选中数据"),
    WORKTIME_NOT_EXIST(1020039,"工时记录不存在"),
    ACCIDENTREPORT_EMPTY_CORP(1020040,"事故报告所属水司不能为空"),
    ACCIDENTREPORT_EMPTY_MANAGER(1020041,"事故报告的负责人不能为空"),
    ACCIDENTREPORT_IS_APPROVEING(1020042,"事故报告正在审批中，无法操作"),
    EVENT_IS_APPROVING(1020043,"事件管理正在审批中，无法操作"),
    EVENT_EMPTY_MANAGER(1020044,"事件管理的审批人不能为空"),
    ACCIDENTBULLETIN_IS_APPROVING(1020045,"事故快报正在审批中，无法操作"),
    ACCIDENTBULLETIN_EMPTY_MANAGER(1020046,"事故快报的审批人不能为空"),
    ;
    private final int code;
    private final String description;

    public int getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    BusinessCode(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public static BusinessCode valueOf(int value){
        return switch (value) {
            case 0 -> SUCCESS;
            case -1 -> FAILURE;
            case -2 -> EXCEPTION;
            case -3 -> NOT_LONGIN;
            case 1020001 -> EVENT_EMPTY_NAME;
            case 1020002 -> EVENT_EMPTY_DEPARTMENTCODE;
            case 1020003 -> EVENT_EMPTY_ACCIDENTTYPE;
            case 1020004 -> EVENT_NOT_CHANGE_DATA;
            case 1020005 -> EVENT_NOT_EXIST;
            case 1020006 -> PECCANCYRECORD_EMPTY_CORPCODE;
            case 1020007 -> PECCANCYRECORD_EMPTY_PECCANCYSTAFF;
            case 1020008 -> PECCANCYRECORD_EMPTY_PECCANCYSTAFFDEPT;
            case 1020009 -> PECCANCYRECORD_EMPTY_PECCANCYBEHAVIOUR;
            case 1020010 -> PECCANCYRECORD_EMPTY_PECCANCYDEGREE;
            case 1020011 -> PECCANCYRECORD_EMPTY_PECCANCYTYPE;
            case 1020012 -> PECCANCYRECORD_EMPTY_BUSINESSID;
            case 1020013 -> PECCANCYRECORD_NOT_CHANGE_DATA;
            case 1020014 -> PECCANCYRECORD_NOT_EXIST;
            case 1020015 -> PECCANCYRECORD_NOT_EXIST_BUSINESSID;
            case 1020016 -> ACCIDENTBULLETIN_EMPTY_NAME;
            case 1020017 -> ACCIDENTBULLETIN_EMPTY_ACCIDENTTYPE;
            case 1020018 -> ACCIDENTBULLETIN_EMPTY_DEPARTMENTCODE;
            case 1020019 -> ACCIDENTBULLETIN_NOT_CHANGE_DATA;
            case 1020020 -> ACCIDENTBULLETIN_NOT_EXIST;
            case 1020021 -> ACCIDENTREPORT_EMPTY_NAME;
            case 1020022 -> ACCIDENTREPORT_EMPTY_ACCIDENTTYPE;
            case 1020023 -> ACCIDENTREPORT_EMPTY_DEPARTMENTCODE;
            case 1020024 -> ACCIDENTREPORT_NOT_CHANGE_DATA;
            case 1020025 -> ACCIDENTREPORT_NOT_EXIST;
            case 1020026 -> INJURIESREGISTER_EMPTY_STAFF;
            case 1020027 -> INJURIESREGISTER_EMPTY_DEPARTMENTCODE;
            case 1020028 -> INJURIESREGISTER_EMPTY_ACCIDENT;
            case 1020029 -> INJURIESREGISTER_NOT_CHANGE_DATA;
            case 1020030 -> INJURIESREGISTER_NOT_EXIST;
            case 1020031 -> WORKTIME_EMPTY_CORPCODE;
            case 1020032 -> WORKTIME_EMPTY_DEPARTMENTCODE;
            case 1020033 -> WORKTIME_EMPTY_YEARS;
            case 1020034 -> WORKTIME_EMPTY_DAYS;
            case 1020035 -> WORKTIME_EMPTY_DAYWORKTIMES;
            case 1020036 -> WORKTIME_EMPTY_TOTALWORKTIES;
            case 1020037 -> WORKTIME_EMPTY_STAFFNUMBER;
            case 1020038 -> WORKTIME_NOT_CHANGE_DATA;
            case 1020039 -> WORKTIME_NOT_EXIST;
            case 1020040 -> ACCIDENTREPORT_EMPTY_CORP;
            case 1020041 -> ACCIDENTREPORT_EMPTY_MANAGER;
            case 1020042 -> ACCIDENTREPORT_IS_APPROVEING;
            case 1020043 -> EVENT_IS_APPROVING;
            case 1020044 -> EVENT_EMPTY_MANAGER;
            case 1020045 -> ACCIDENTBULLETIN_IS_APPROVING;
            case 1020046 -> ACCIDENTBULLETIN_EMPTY_MANAGER;
            default -> null;
        };
    }
}
